<!doctype html>
<html lang="ch">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="description" content="左右结构项目，属于大人员的社交工具">
        <meta name="keywords" content="左右结构项目 社交 占座 ">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="format-detection" content="telephone=no">
        <title>用户</title>
        <script src="js/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script>
            $(function() {
                $(".meun-item").click(function() {
                    $(".meun-item").removeClass("meun-item-active");
                    $(this).addClass("meun-item-active");
                    var itmeObj = $(".meun-item").find("img");
                    itmeObj.each(function() {
                        var items = $(this).attr("src");
                        items = items.replace("_grey.png", ".png");
                        items = items.replace(".png", "_grey.png")
                        $(this).attr("src", items);
                    });
                    var attrObj = $(this).find("img").attr("src");
                    ;
                    attrObj = attrObj.replace("_grey.png", ".png");
                    $(this).find("img").attr("src", attrObj);
                });
                $("#topAD").click(function() {
                    $("#topA").toggleClass(" glyphicon-triangle-right");
                    $("#topA").toggleClass(" glyphicon-triangle-bottom");
                });
                $("#topBD").click(function() {
                    $("#topB").toggleClass(" glyphicon-triangle-right");
                    $("#topB").toggleClass(" glyphicon-triangle-bottom");
                });
                $("#topCD").click(function() {
                    $("#topC").toggleClass(" glyphicon-triangle-right");
                    $("#topC").toggleClass(" glyphicon-triangle-bottom");
                });
                $(".toggle-btn").click(function() {
                    $("#leftMeun").toggleClass("show");
                    $("#rightContent").toggleClass("pd0px");
                })
            })
        </script>
        <!--[if lt IE 9]>
  <script src="js/html5shiv.min.js"></script>
  <script src="js/respond.min.js"></script>
<![endif]-->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="css/common.css" />
        <link rel="stylesheet" type="text/css" href="css/slide.css" />
        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="css/flat-ui.min.css" />
        <link rel="stylesheet" type="text/css" href="css/jquery.nouislider.css">
    </head>

    <body>
        <div id="wrap">
            <!-- 左侧菜单栏目块 -->
            <div class="leftMeun" id="leftMeun">
                <div id="logoDiv">
                    <p id="logoP"><img id="logo" alt="左右结构项目" src="images/logo.png"><span>电子设备报修系统</span></p>
                </div>
                <div id="personInfor">
                    <p id="userN">
                    </p>
                    <p id="userT">
                    </p>
                    <p>
                        <a onclick="logout()">退出登录</a>
                    </p>
                </div>
                <div class="meun-title">用户操作</div>
                <div class="meun-item meun-item-active" href="#repair" aria-controls="sour" role="tab" data-toggle="tab"><img src="images/icon_repair.png">报修或回收</div>
                <div class="meun-item" href="#comment" aria-controls="user" role="tab" data-toggle="tab" onclick="pageByuser(1,true)"><img src="images/icon_send_grey.png">当前订单</div>
                <div class="meun-item" href="#fault" aria-controls="chan" role="tab" data-toggle="tab" onclick="page(1,true) "><img src="images/icon_fault_grey.png">故障管理</div>
                <div class="meun-title">账号管理</div>
                <div class="meun-item" href="#chan" aria-controls="scho" role="tab" data-toggle="tab"><img src="images/icon_changePassword_grey.png">修改密码</div>
            </div>
            <!-- 右侧具体内容栏目 -->
            <div id="rightContent">
                <a class="toggle-btn" id="nimei">
                    <i class="glyphicon glyphicon-align-justify"></i>
                </a>
                <!-- Tab panes -->
                <div class="tab-content">
                    <!-- 报修或回收模块 -->
                    <div role="tabpanel" class="tab-pane active" id="repair">
                        <div class="check-div">

                        </div>
                        <div style="padding: 50px 0;margin-top: 50px;background-color: #fff; text-align: right;width: 600px;margin: 50px auto;">
                            <form class="form-horizontal">

                                <div class="form-group">
                                    <label for="sKnot" class="col-xs-4 control-label">故障地点：</label>
                                    <div class="col-xs-5">
                                        <textarea id="faultSite" class="form-control input-sm duiqi"  placeholder="" style="margin-top: 10px;"></textarea>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="sKnot" class="col-xs-4 control-label">故障类型：</label>
                                    <div class="col-xs-5">
                                        <select id="faultCategory" class="form-control input-sm duiqi"  placeholder="" style="margin-top: 10px;">

                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="sKnot" class="col-xs-4 control-label">处理方式：</label>
                                    <div class="col-xs-5">
                                        <select id="faultWay" class="form-control input-sm duiqi"  placeholder="" style="margin-top: 10px;">
                                            <option value="0">报修</option>
                                            <option value="1">回收</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="sKnot" class="col-xs-4 control-label">故障描述：</label>
                                    <div class="col-xs-5">
                                        <textarea id="faultInfo" class="form-control input-sm duiqi" id="sKnot" placeholder="" style="margin-top: 10px;height: 100px;"></textarea>
                                    </div>
                                </div>

                                <div class="form-group text-right">
                                    <div class="col-xs-offset-4 col-xs-5" style="margin-left: 169px;">
                                        <button type="reset" class="btn btn-xs btn-white">取 消</button>
                                        <button type="submit" class="btn btn-xs btn-green" onclick="send()">确认</button>
                                    </div>
                                </div>
                            </form>
                        </div>

                    </div>

            <!--当前订单模块-->
            <div role="tabpanel" class="tab-pane" id="comment">
                <div class="check-div form-inline">
                </div>
                <div class="data-div">
                    <div class="row tableHeader">
                        <div class="col-xs-1 ">
                            编号
                        </div>
                        <div class="col-xs-1">
                            故障类型
                        </div>
                        <div class="col-xs-3">
                            故障地点
                        </div>
                        <div class="col-xs-3">
                            故障描述
                        </div>
                        <div class="col-xs-2">
                            当前状态
                        </div>
                        <div class="col-xs-2">
                            操作
                        </div>
                    </div>
                    <div class="tablebody" id="userFaultList">
                    </div>

                </div>
                <!--页码块-->
                <footer class="footer">
                    <ul class="pagination">
                        <li>
                            <select id="userPages">
                            </select>
                            页
                        </li>
                        <li class="gray" id="userTotalPages">
                        </li>
                        <li id="orderLeft">
                        </li>
                        <li id="orderRight">
                        </li>
                    </ul>
                </footer>


                <!--评论窗口-->
                <div class="modal fade" id="reviseUser" role="dialog" aria-labelledby="gridSystemModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="gridSystemModalLabel">添加评论</h4>
                            </div>
                            <div class="modal-body">
                                <div class="container-fluid">
                                    <form class="form-horizontal">
                                        <div class="form-group ">
                                            <label for="userComment" class="col-xs-3 control-label">评论：</label>
                                            <div class="col-xs-8 ">
                                                <input type="email" class="form-control input-sm duiqi" id="userComment" placeholder="">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-xs btn-white" data-dismiss="modal" onclick="userComment.value = '';">取 消</button>
                                <button type="button" class="btn btn-xs btn-green" data-dismiss="modal" aria-label="Close" onclick="comment()">保 存</button>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!--修改密码模块-->
            <div role="tabpanel" class="tab-pane" id="chan">
                <div class="check-div">

                </div>
                <div style="padding: 50px 0;margin-top: 50px;background-color: #fff; text-align: right;width: 420px;margin: 50px auto;">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <label for="oldPassword" class="col-xs-4 control-label">原密码：</label>
                            <div class="col-xs-5">
                                <input type="password" name="oldPassword" class="form-control input-sm duiqi" id="oldPassword" placeholder="" style="margin-top: 7px;">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="newPassword" class="col-xs-4 control-label">新密码：</label>
                            <div class="col-xs-5">
                                <input type="password" name="newPassword" class="form-control input-sm duiqi" id="newPassword" placeholder="" style="margin-top: 7px;">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="newPasswordAgain" class="col-xs-4 control-label">重复密码：</label>
                            <div class="col-xs-5">
                                <input type="password" name="newPasswordAgain" class="form-control input-sm duiqi" id="newPasswordAgain" placeholder="" style="margin-top: 7px;">
                            </div>
                        </div>
                        <div class="form-group text-right">
                            <div class="col-xs-offset-4 col-xs-5" style="margin-left: 169px;">
                                <button type="reset" class="btn btn-xs btn-white">取 消</button>
                                <button type="button" class="btn btn-xs btn-green" onclick="changePassword()">保存</button>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
            <!-- 故障管理模块 -->
            <div role="tabpanel" class="tab-pane" id="fault">

                <div class="check-div form-inline">
                    <div class="col-lg-4 col-xs-5">
                        <label for="paixu">故障类型:&nbsp;</label>
                        <select id="category" class="form-control">

                        </select>
                        <button class="btn btn-white btn-xs" onclick="query(1,false)">查 询 </button>
                    </div>
                </div>
                <div class="data-div">
                    <div class="row tableHeader">
                        <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
                            故障类型
                        </div>
                        <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
                            故障地点
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 ">
                            故障描述
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 ">
                            解决方案
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 ">
                            故障发生日期
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 ">
                            故障解决日期
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 ">
                            故障维修员
                        </div>
                    </div>
                    <div class="tablebody" id="faultList">

                    </div>

                </div>
                <!--页码块-->
                <footer class="footer">
                    <ul class="pagination">
                        <li >
                            <select id="pages">
                            </select>
                            页
                        </li>
                        <li class="gray" id="totalPages">
                        </li>
                        <li id="Left">
                        </li>
                        <li id="Right">
                        </li>
                    </ul>
                </footer>


            </div>
        </div>
    </div>
</div>
<script src="js/jquery.nouislider.js"></script>

<script>

    var userN = document.getElementById('userN')
    var userT = document.getElementById('userT')
    var userId = null;
    $.ajax({
        type:'POST',
        url:'user/get_user_info.do',
        async:false,
        success:function (res) {
            if(res.status == 0){
                userN.innerHTML="用户: "+res.data.userName
                userT.innerHTML="联系电话: "+res.data.userTel
                userId = res.data.userId
            }
        }
    })


    var faultSite = document.getElementById('faultSite')
    var faultCategory = document.getElementById('faultCategory')
    var category = document.getElementById('category')
    var faultInfo = document.getElementById('faultInfo')
    var faultWay = document.getElementById('faultWay')

    function send() {

        $.ajax({
            type:'GET',
            url:'user/user_place_order.do',
            data:{
                faultDescribe:faultInfo.value,
                faultCategoryId:faultCategory.value,
                faultSite:faultSite.value,
                faultWay:faultWay.value,
                faultUserId:userId
            }
        })
        // var fault = new Object()
        // fault.faultCategory = faultCategory.value
        // fault.faultSite = faultSite.value
        // fault.faultInfo = faultInfo.value
        // var msg = JSON.stringify(fault)
    }


    $.ajax({
        type:'GET',
        url:'user/select_all_fault_category.do',
        success:function (res) {
            if(res.status == 0){
                for(var i = 0;i <res.data.length;i++){
                    var option = document.createElement('option')
                    option.value = res.data[i].faultCategoryId
                    option.innerHTML = res.data[i].faultCategoryName
                    faultCategory.appendChild(option)
                }
                for(var i = 0;i <res.data.length;i++){
                    var option = document.createElement('option')
                    option.value = res.data[i].faultCategoryId
                    option.innerHTML = res.data[i].faultCategoryName
                    category.appendChild(option)
                }
            }
        }
    })


    var faultList = document.getElementById('faultList')
    var pages = document.getElementById('pages')
    var totalPages = document.getElementById('totalPages')
    var Left = document.getElementById('Left')
    var Right = document.getElementById('Right')
    var pe = 0;
    function page(p,f) {
        while(faultList.hasChildNodes()){
            faultList.removeChild(faultList.firstChild)
        }
        $.ajax({
            type:'GET',
            url:'user/fault_list.do',
            data:{
                pageNum:p
            },
            success:function (res) {
                if(res.status == 0){
                    while(Left.hasChildNodes()){
                        Left.removeChild(Left.firstChild)
                    }
                    while(Right.hasChildNodes()){
                        Right.removeChild(Right.firstChild)
                    }
                    var il = document.createElement('i')
                    var ir = document.createElement('i')
                    il.className="glyphicon glyphicon-menu-left"
                    ir.className="glyphicon glyphicon-menu-right"
                    Left.appendChild(il)
                    Right.appendChild(ir)
                    il.onclick = function () {
                        if(res.data.isFirstPage == false){
                            page(--p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    ir.onclick = function () {
                        if(res.data.hasNextPage == true){
                            page(++p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    totalPages.innerHTML = "共"+res.data.pages+"页"+",当前第"+p+"页"
                    if(res.data.pages != pe || f == true){
                        while(pages.hasChildNodes()){
                            pages.removeChild(pages.firstChild)
                        }
                        for(var i = 0;i < res.data.pages;i++){
                            crateP(i,res)
                        }
                    }
                    pe = res.data.pages
                    pages.onchange = function (e){
                        page(e.target.value,false)
                    }
                    for(var j = 0;j < res.data.list.length;j++){
                        createRow(j,res)
                    }
                }
            }
        })
    }


    function crateP(i,res) {
        var option =  document.createElement('option')
        option.innerHTML= res.data.navigatepageNums[i]
        option.value = res.data.navigatepageNums[i]
        pages.appendChild(option)
    }

    function createRow(j,res) {
        var div = document.createElement('div')
        var div1 =  document.createElement('div')
        var div2 =  document.createElement('div')
        var div3 =  document.createElement('div')
        var div4 =  document.createElement('div')
        var div5 =  document.createElement('div')
        var div6 =  document.createElement('div')
        var div7 =  document.createElement('div')
        div.className="row"
        div1.className="col-lg-1 col-md-1 col-sm-1 col-xs-1"
        div2.className="col-lg-1 col-md-1 col-sm-1 col-xs-1 "
        div3.className="col-lg-2 col-md-2 col-sm-2 col-xs-2 "
        div4.className="col-lg-2 col-md-2 col-sm-2 col-xs-2 "
        div5.className="col-lg-2 col-md-2 col-sm-2 col-xs-2 "
        div6.className="col-lg-2 col-md-2 col-sm-2 col-xs-2 "
        div7.className="col-lg-2 col-md-2 col-sm-2 col-xs-2 "
        div1.innerHTML=res.data.list[j].faultCategoryName
        div2.innerHTML=res.data.list[j].faultSite
        div3.innerHTML=res.data.list[j].faultDescribe
        div4.innerHTML=res.data.list[j].faultSolution
        div5.innerHTML=res.data.list[j].faultTime
        div6.innerHTML=res.data.list[j].faultSolutionTime
        div7.innerHTML=res.data.list[j].maintainerName
        div.appendChild(div1)
        div.appendChild(div2)
        div.appendChild(div3)
        div.appendChild(div4)
        div.appendChild(div5)
        div.appendChild(div6)
        div.appendChild(div7)
        faultList.appendChild(div)
    }

    function query(p,f) {
        while(faultList.hasChildNodes()){
            faultList.removeChild(faultList.firstChild)
        }
        $.ajax({
            type:'GET',
            url:'user/select_fault_by_category.do',
            data:{
                faultCategoryId:category.value,
                pageNum:p
            },
            success:function (res) {
                if(res.status == 0){
                    while(Left.hasChildNodes()){
                        Left.removeChild(Left.firstChild)
                    }
                    while(Right.hasChildNodes()){
                        Right.removeChild(Right.firstChild)
                    }
                    var il = document.createElement('i')
                    var ir = document.createElement('i')
                    il.className="glyphicon glyphicon-menu-left"
                    ir.className="glyphicon glyphicon-menu-right"
                    Left.appendChild(il)
                    Right.appendChild(ir)
                    il.onclick = function () {
                        if(res.data.isFirstPage == false){
                            query(--p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    ir.onclick = function () {
                        if(res.data.hasNextPage == true){
                            query(++p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    totalPages.innerHTML = "共"+res.data.pages+"页"+",当前第"+p+"页"
                    if(f == false){
                        while(pages.hasChildNodes()){
                            pages.removeChild(pages.firstChild)
                        }
                        for(var i = 0;i < res.data.pages;i++){
                            crateP(i,res)
                        }
                    }
                    pages.onchange = function (e){
                        while(faultList.hasChildNodes()){
                            faultList.removeChild(faultList.firstChild)
                        }
                        f = true
                        query(e.target.value,f)
                    }
                    for(var j = 0;j < res.data.list.length;j++){
                        createRow(j,res)
                    }
                }
                if(res.status == 1){
                    crateIm(res)
                }
            }
        })
    }

    function crateIm(res) {
        var img = document.createElement('img')
        var h5 = document.createElement('h5')
        img.className="center-block"
        img.style.marginTop = "100px"
        img.src="images/not_found.png"
        h5.className="center-block"
        h5.style.textAlign="center"
        h5.style.marginTop="30px"
        h5.innerHTML=res.msg
        faultList.appendChild(img)
        faultList.appendChild(h5)
    }


    var userFaultList = document.getElementById('userFaultList')
    var userPages = document.getElementById('userPages')
    var userTotalPages = document.getElementById('userTotalPages')
    var orderLeft =document.getElementById('orderLeft')
    var orderRight =document.getElementById('orderRight')
    var peg = 0
    function pageByuser(p,flag) {
        while(userFaultList.hasChildNodes()){
            userFaultList.removeChild(userFaultList.firstChild)
        }
        $.ajax({
            type:'GET',
            url:'user/select_fault_by_user_id.do',
            data:{
                userId:userId,
                pageNum:p
            },
            success:function (res) {
                if(res.status == 0){
                    while(orderLeft.hasChildNodes()){
                        orderLeft.removeChild(orderLeft.firstChild)
                    }
                    while(orderRight.hasChildNodes()){
                        orderRight.removeChild(orderRight.firstChild)
                    }
                    var il = document.createElement('i')
                    var ir = document.createElement('i')
                    il.className="glyphicon glyphicon-menu-left"
                    ir.className="glyphicon glyphicon-menu-right"
                    orderLeft.appendChild(il)
                    orderRight.appendChild(ir)
                    il.onclick = function () {
                        if(res.data.isFirstPage == false){
                            pageByuser(--p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    ir.onclick = function () {
                        if(res.data.hasNextPage == true){
                            pageByuser(++p,false)
                        }else{
                            window.location.href="javascript:void(0)"
                        }
                    }
                    userTotalPages.innerHTML = "共"+res.data.pages+"页"
                    if(res.data.pages != peg || flag == true){
                        while(userPages.hasChildNodes()){
                            userPages.removeChild(userPages.firstChild)
                        }
                        for(var i = 0;i < res.data.pages;i++){
                            cratePeg(i,res)
                        }
                    }
                    peg = res.data.pages
                    userPages.onchange = function (e){
                        pageByuser(e.target.value,false)
                    }
                    for(var j = 0;j < res.data.list.length;j++){
                        if(res.data.list[j].faultStatus == 3){
                            createR(j,res,"评价",true)
                        }else{
                            createR(j,res,"暂无",false)
                        }

                    }
                }
                if(res.status == 1){
                    crateI(res)
                }
            }
        })
    }

    function cratePeg(i,res) {
        var option =  document.createElement('option')
        option.innerHTML= res.data.navigatepageNums[i]
        option.value = res.data.navigatepageNums[i]
        userPages.appendChild(option)
    }

    var commentFaultId = null
    var commentMaintainerId = null
    function createR(j,res,str,flag) {
        var div = document.createElement('div')
        var div1 =  document.createElement('div')
        var div2 =  document.createElement('div')
        var div3 =  document.createElement('div')
        var div4 =  document.createElement('div')
        var div5 =  document.createElement('div')
        var div6 =  document.createElement('div')
        var button = document.createElement('button')
        div.className="row"
        div1.className="col-lg-1 col-md-1 col-sm-1 col-xs-1"
        div2.className="col-lg-1 col-md-1 col-sm-1 col-xs-1"
        div3.className="col-lg-3 col-md-3 col-sm-3 col-xs-3"
        div4.className="col-lg-3 col-md-3 col-sm-3 col-xs-3"
        div5.className="col-lg-2 col-md-2 col-sm-2 col-xs-2"
        div6.className="col-lg-2 col-md-2 col-sm-2 col-xs-2"
        div1.innerHTML=res.data.list[j].faultId
        div2.innerHTML=res.data.list[j].faultCategoryName
        div3.innerHTML=res.data.list[j].faultSite
        div4.innerHTML=res.data.list[j].faultDescribe
        div5.innerHTML=res.data.list[j].faultStatusName
        button.innerHTML=str
        if(flag == true){
            button.onclick=function (){
                commentFaultId = res.data.list[j].faultId
                commentMaintainerId = res.data.list[j].faultMaintainerId
            }
            button.className="btn btn-success btn-xs"
            button.setAttribute("data-toggle","modal")
            button.setAttribute("data-target","#reviseUser")
        }else{
            button.className="btn btn-warning btn-xs"
        }
        div6.appendChild(button)
        div.appendChild(div1)
        div.appendChild(div2)
        div.appendChild(div3)
        div.appendChild(div4)
        div.appendChild(div5)
        div.appendChild(div6)
        userFaultList.appendChild(div)
    }

    function crateI(res) {
        var img = document.createElement('img')
        var h5 = document.createElement('h5')
        img.className="center-block"
        img.style.marginTop = "100px"
        img.src="images/not_found.png"
        h5.className="center-block"
        h5.style.textAlign="center"
        h5.style.marginTop="30px"
        h5.innerHTML=res.msg
        userFaultList.appendChild(img)
        userFaultList.appendChild(h5)
    }


    var userComment = document.getElementById('userComment')

    function comment() {
        $.ajax({
            type:"GET",
            url:"user/user_comment.do",
            data:{
                commentText:userComment.value,
                faultId:commentFaultId,
                maintainerId:commentMaintainerId
            },
            success:function(res){
                if(res.status == 0){
                    userComment.value = ''
                    pageByuser(1,true)
                }
                if(res.status == 1){
                    alert(res.msg)
                }
            }
        })

    }


    var oldPassword = document.getElementById('oldPassword')
    var newPassword = document.getElementById('newPassword')
    var newPasswordAgain = document.getElementById('newPasswordAgain')
    function changePassword() {
        $.ajax({
            type: 'POST',
            url: 'user/new_password.do',
            data: {
                userId: userId,
                oldPassword: oldPassword.value,
                newPassword:newPassword.value,
                newPasswordAgain:newPasswordAgain.value
            },
            success: function (res) {
                oldPassword.value=""
                newPassword.value=""
                newPasswordAgain.value=""
                if(res.status == 0){
                    alert("修改成功!")
                }else{
                    alert(res.msg)
                }
            }
        })
    }


    function logout() {
        $.ajax({
            type:'POST',
            url:'user/logout.do',
            success:function (res) {
                if(res.status == 0){
                    window.location.href="login.html"
                }
            }
        })
    }



    function huadong(my, unit, def, max) {
        $(my).noUiSlider({
            range: [0, max],
            start: [def],
            handles: 1,
            connect: 'upper',
            slide: function() {
                var val = Math.floor($(this).val());
                $(this).find(".noUi-handle").text(
                    val + unit
                );
                console.log($(this).find(".noUi-handle").parent().parent().html());
            },
            set: function() {
                var val = Math.floor($(this).val());
                $(this).find(".noUi-handle").text(
                    val + unit
                );
            }
        });
        $(my).val(def, true);
    }
    huadong('.slider-minmax1', "分钟", "5", 30);
    huadong('.slider-minmax2', "分钟", "6", 15);
    huadong('.slider-minmax3', "分钟", "10", 60);
    huadong('.slider-minmax4', "次", "2", 10);
    huadong('.slider-minmax5', "天", "3", 7);
    huadong('.slider-minmax6', "天", "8", 10);
</script>
</body>

</html>